package com.ruoyi.car.service.impl;


import com.ruoyi.car.domain.CarList;
import com.ruoyi.car.mapper.CarListMapper;
import com.ruoyi.car.service.ICarListService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 汽车Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-24
 */
@Service
public class CarListServiceImpl implements ICarListService {
    @Autowired
    private CarListMapper carListMapper;

    /**
     * 查询汽车
     *
     * @param carId 汽车主键
     * @return 汽车
     */
    @Override
    public CarList selectCarListByCarId(Long carId) {
        return carListMapper.selectCarListByCarId(carId);
    }

    /**
     * 查询汽车列表
     *
     * @param carList 汽车
     * @return 汽车
     */
    @Override
    public List<CarList> selectCarListList(CarList carList) {
        return carListMapper.selectCarListList(carList);
    }

    /**
     * 新增汽车
     *
     * @param carList 汽车
     * @return 结果
     */
    @Override
    public int insertCarList(CarList carList) {
        carList.setCreateTime(DateUtils.getNowDate());
        return carListMapper.insertCarList(carList);
    }

    /**
     * 修改汽车
     *
     * @param carList 汽车
     * @return 结果
     */
    @Override
    public int updateCarList(CarList carList) {
        carList.setUpdateTime(DateUtils.getNowDate());
        return carListMapper.updateCarList(carList);
    }

    /**
     * 批量删除汽车
     *
     * @param carIds 需要删除的汽车主键
     * @return 结果
     */
    @Override
    public int deleteCarListByCarIds(Long[] carIds) {
        return carListMapper.deleteCarListByCarIds(carIds);
    }

    /**
     * 删除汽车信息
     *
     * @param carId 汽车主键
     * @return 结果
     */
    @Override
    public int deleteCarListByCarId(Long carId) {
        return carListMapper.deleteCarListByCarId(carId);
    }
}

